#!/bin/bash

problems=(
    "17. 电话号码的字母组合"
    "22. 括号生成"
    "37. 解数独"
    "39. 组合总和"
    "46. 全排列"
    "77. 组合"
    "78. 子集"
    "51. N皇后"
    "104. 二叉树的最大深度"
    "494. 目标和"
    "698. 划分为 k 个相等的子集"
)

for prob in "${problems[@]}"; do
    num=$(echo $prob | grep -oE '^[0-9]+')
    title=$(echo $prob | sed "s/$num//g" | xargs)
    # 移除标题中的点号
    title=${title//./}
    filename="LC_${num}_${title// /_}.java"
    cat > $filename <<EOF
package org.labuladong.暴力搜索算法.回溯算法;

/**
 * @Author: qingle
 * @Date: 2024/10/28-16:11
 * @Description: $prob
 * @version: 1.0
 */
public class LC_${num}_${title// /_} {
}
EOF
done